<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="UTF-8">
        <title>Title</title>
        <script>
            function f1(){
                alert(window.location);
            }

            function f2(){
                win=open("1.html","w1","width=400,height=400");

                // win.location="2.html";

            }
        </script>
    </head>
    <body>

        <button type="button" onclick="window.location='1.html'">test</button>
        <button type="button" onclick="f1();">test</button>

        <a href="javascript:;" onclick="f2();">打开</a>
    </body>
</html>